﻿Imports System.Windows.Data
Imports System.Windows.Media

''' <summary>
''' Convertit l'etat d'une table de données en couleur
''' </summary>
''' <remarks></remarks>
Public Class InitTableStateToColorConverter
    Implements IValueConverter

    
    Private Function Convert(ByVal value As Object, ByVal targetType As System.Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConverter.Convert
        Try

            Dim s = value.ToLower()
            If s = "default" Then
                Return Brushes.Yellow
            End If
            If s = "ready" Then
                Return Brushes.Green
            End If
            If s = "notfound" Then
                Return Brushes.Red
            End If
        Catch ex As Exception
            Return Brushes.Black
        End Try
        Return Brushes.Black
    End Function

    Private Function ConvertBack(ByVal value As Object, ByVal targetType As System.Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConverter.ConvertBack
        Throw New NotImplementedException()
    End Function
End Class